﻿using System;
using System.Collections.Generic;
namespace Efficient.Domain
{
    public delegate bool Func<T>(T left, T right); 
    /// <summary>
    /// 用于对比2个集合中数据的差别
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public interface IGenericDirtyEntitySet<T>
    {
        /// <summary>
        /// 获取较之原来集合是应该被删除的数据
        /// </summary>
        /// <returns></returns>
        IList<T> GetToBeDelete();
        /// <summary>
        /// 获取较之原来集合是应该被删除的数据
        /// </summary>
        /// <param name="predicate">判断的条件委托</param>
        /// <returns></returns>
        IList<T> GetToBeDelete(Func<T> predicate);
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        IList<T> GetToBeInsert();
        /// <summary>
        /// 获取较之原来集合是新增加的数据
        /// </summary>
        /// <param name="predicate">判断的条件委托</param>
        /// <returns></returns>
        IList<T> GetToBeInsert(Func<T> predicate);
        /// <summary>
        /// 获取较之原来集合是应该被更新的数据
        /// </summary>
        /// <returns></returns>
        IList<T> GetToBeUpdate();
        /// <summary>
        /// 获取较之原来集合是应该被更新的数据
        /// </summary>
        /// <param name="predicate">判断的条件委托</param>
        /// <returns></returns>
        IList<T> GetToBeUpdate(Func<T> predicate);
    }
}
